<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>审计档案归档明细统计首页</title>
    <jsp:include page="/zheng-admin-plugins/plugins/inc/head.jsp" flush="true"/>
    <script src="${basePath}/js/date.js"></script>
</head>
<body>
<div id="main">
    <div id="toolbar">
        <shiro:hasPermission name="upms:user:create"><a id="1" class="waves-effect waves-button" href="javascript:;" onclick="searchDialogAction(this.id)"><i class="glyphicon glyphicon-search"></i>&nbsp 查询</a></shiro:hasPermission>
        <%--<shiro:hasPermission name="upms:user:update"><a id="2" class="waves-effect waves-button" href="javascript:;" onclick="searchDialogAction(this.id)"><i class="zmdi zmdi-edit"></i> 年度</a></shiro:hasPermission>
        <shiro:hasPermission name="upms:user:delete"><a id="3" class="waves-effect waves-button" href="javascript:;" onclick="searchDialogAction(this.id)"><i class="zmdi zmdi-close"></i> 保管期限</a></shiro:hasPermission>
        <shiro:hasPermission name="upms:user:organization"><a id="4" class="waves-effect waves-button" href="javascript:;" onclick="searchDialogAction(this.id)"><i class="zmdi zmdi-accounts-list"></i> 密级</a></shiro:hasPermission>
        <shiro:hasPermission name="upms:user:role"><a id="5" class="waves-effect waves-button" href="javascript:;" onclick="searchDialogAction(this.id)"><i class="zmdi zmdi-accounts"></i> 归档时间</a></shiro:hasPermission>--%>
        <div class="modal fade" id="searchDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="searchDialogTitle"></h4>
                    </div>
                    <div class="modal-body">
                        <form id="createForm" method="post">
                            <div class="form-group">
                                <label for="VOL_ARCHIVE_UNIT">归档单位</label>
                                <input id="VOL_ARCHIVE_UNIT" type="text" class="form-control" name="VOL_ARCHIVE_UNIT" maxlength="20">
                            </div>
                            <div class="form-group">
                                <label for="VOL_ARCHIVE_YEAR">年度（例：2016）</label>
                                <input id="VOL_ARCHIVE_YEAR" type="text" class="form-control" name="VOL_ARCHIVE_YEAR" maxlength="32">
                            </div>
                            <div class="form-group">
                                <label for="VOL_STORAGE_TIME">保管期限（例：10年/30年/永久）</label>
                                <input id="VOL_STORAGE_TIME" type="text" class="form-control" name="VOL_STORAGE_TIME" maxlength="20">
                            </div>
                            <div class="form-group">
                                <label for="VOL_SECRET">密级</label>
                                <input id="VOL_SECRET" type="text" class="form-control" name="VOL_SECRET" maxlength="20">
                            </div>
                            <div class="form-group">
                                <label for="starttime">归档时间（起始时间）</label>
                               <input style="background-color: #FFFFFF" type="text"id="starttime" readonly="readonly" class="form-control" name="starttime" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})" maxlength="50"/>
                            </div>
                            <div class="form-group">
                                <label for="endtime">归档时间（截止时间）</label>
                                <input style="background-color: #FFFFFF" type="text" id="endtime" readonly="readonly" class="form-control" name="endTime"onFocus="WdatePicker({minDate:'#F{$dp.$D(\'starttime\')}',maxDate: '%y-%M-%d',dateFmt:'yyyy-MM-dd'})" maxlength="50"/>
                            </div>
                            <div class="form-group text-right dialog-buttons">
                                <%-- <a class="waves-effect waves-button" href="javascript:;"></a>
                                 <a class="waves-effect waves-button" href="javascript:;" onclick="searchDialog.close();"></a>--%>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary"  onclick="querySubmit();">查询</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </div>
    <table id="table"></table>

</div>
<script src="${basePath}/zheng-admin-plugins/plugins/My97DatePicker/WdatePicker.js"></script>
<jsp:include page="/zheng-admin-plugins/plugins/inc/footer.jsp" flush="true"/>
<script>
    var $table = $('#table');
    var sign;
    $(function() {
        sign="0";
        // bootstrap table初始化
        $table.bootstrapTable({
            url: '${basePath}/pcwindow/secretArcStatisticsDetail',
            queryParams:queryParams,
            striped: true,
           // search: true,
            showRefresh: true,
            showColumns: true,
            minimumCountColumns: 2,
            clickToSelect: true,
            detailView: true,
            detailFormatter: 'detailFormatter',
            pagination: true,
            paginationLoop: false,
            sidePagination: 'server',
            silentSort: false,
            smartDisplay: false,
            escape: true,
            searchOnEnterKey: true,
            idField: 'userId',
            maintainSelected: true,
            toolbar: '#toolbar',
            showFooter: true,
            columns: [
                {field: 'ck', checkbox: true},
                {field: 'itemNumber',  title: '序号',
                    formatter: function (value, row, index) {
                        return index+1;
                    }},
                {field: 'itemName', title: '文号', align: 'center'},
                {field: 'itemTitle', title: '题名', align: 'center'},
                {field: 'itemSecret', title: '密级',align: 'center'},
                {field: 'itemStorageSecret', title: '保密期限', align: 'center'},
                {field: 'decrType', title: '解密类型', align: 'center'},
                {field: 'decrDate', title: '解密日期', align: 'center'},
                {field: 'decrResult', title: '解密后处理', align: 'center'},
                {field: 'decrReperson', title: '定密责任人', align: 'center'},
            ],
            onLoadSuccess:function(data){
                //无数据隐藏分页
                if(data && data.total == 0){
                    $('.fixed-table-pagination').hide()
                }
            }
        });
    });
    // 搜索弹窗
    function searchDialogAction(flag) {
        sign=flag;
        $("#searchDialogTitle").html("查询");
        $("#searchDialog").modal("show");
    }

    //获取搜索数据
    function querySubmit() {
        $table.bootstrapTable('refresh');
        $("#searchDialog").modal("hide");
    }
    //搜索传递参数
    function queryParams(params) {
        //这里的键的名字和控制器的变量名必须一致，这边改动，控制器也需要改成一样的
        var temp = {
            limit: params.limit,   //页面大小
            offset: params.offset,  //页码
            VOL_ARCHIVE_UNIT:$("#VOL_ARCHIVE_UNIT").val(),
            VOL_ARCHIVE_YEAR:$("#VOL_ARCHIVE_YEAR").val(),
            VOL_STORAGE_TIME:$("#VOL_STORAGE_TIME").val(),
            VOL_SECRET:$("#VOL_SECRET").val(),
            starttime:$("#starttime").val(),
            endtime:$("#endtime").val(),
            flag:sign,
        };
        return temp;
    }
</script>
</body>
</html>